/*

 */
package com.ohos.connent.accountcloud.sys.modular.resource.provider;


import cn.hutool.core.bean.BeanUtil;
import com.ohos.connent.accountcloud.sys.api.SysPermissionsApi;
import com.ohos.connent.accountcloud.sys.modular.resource.entity.SysPermissions;
import com.ohos.connent.accountcloud.sys.modular.resource.service.SysPermissionsService;
import com.ohos.connent.accountcloud.sys.pojo.SysPermissionsPojo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * API接口实现类
 *
 *
 **/
@Service
public class SysPermissionsApiProvider implements SysPermissionsApi {

    @Resource
    private SysPermissionsService sysPermissionsService;

    @Override
    public List<SysPermissionsPojo> getSysPermissionsListByIds(List<String> ids) {
       List<SysPermissions> list =  sysPermissionsService.getSysPermissionsListByIds(ids);
       List<SysPermissionsPojo> sysPermissionsPojos = new ArrayList<>();
       if(BeanUtil.isNotEmpty(list)){
           list.forEach(sysPermissions -> {
               SysPermissionsPojo sysPermissionsPojo = BeanUtil.copyProperties(sysPermissions,SysPermissionsPojo.class);
               sysPermissionsPojos.add(sysPermissionsPojo);
           });
       }
        return sysPermissionsPojos;
    }
}
